package com.infoDiffusion.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.infoDiffusion.bean.HydroStatBean;
import com.infoDiffusion.dao.HydroStatDao;

@Service
@Transactional(propagation = Propagation.REQUIRED)
public class HydroStatService {
	@Autowired
	private HydroStatDao hdao;

	public boolean add(HydroStatBean hbean) {
		return hdao.add(hbean);
	}

	public List list(HydroStatBean hbean) {
		String hql = "from HydroStatBean";
		return hdao.getList(hql);
	}

	public boolean update(HydroStatBean hbean) {
		return hdao.update(hbean);
	}

	public HydroStatBean getById(int id) {
		return (HydroStatBean) hdao.getById(HydroStatBean.class, id);
	}

	public boolean delete(HydroStatBean hbean) {
		hdao.delete(hbean);
		return true;
	}

	public boolean updateById(int id) {
		String hql = "update HydroStatBean set username=?,password=?,power=?,create_date=?";
		return hdao.updateById(hql, id);
	}

}
